<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:U('Product/index')}"> 商品列表 </a></li>
        <li ><a href="{:U('Product/add')}"> 添加商品 </a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Product/index')}">
        名称:
        <input type="text" name="name" style="width: 100px;" value="{:I('request.name/s','')}" placeholder="请输入商品名称">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:U('Product/index')}">清空</a>
    </form>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th width="50">ID</th>
            <th> 商品名称 </th>
            <th> 商品主图 </th>
            <th> 价格 </th>
            <th> 商品分类 </th>
            <th> 品牌 </th>
            <th> 库存 </th>
            <th> 已售 </th>
            <th> 创建时间 </th>
            <th> 状态 </th>
            <th width="200">操作</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="list" item="vo">
            <tr>
                <td>{$vo.id}</td>
                <td>{$vo['title']}</td>
                <td><img style="height: 40px;" src="{$vo['image']}" alt=""> </td>
                <td>
                    {$vo['price']}
                </td>
                <td>
                    {$vo['category']}
                </td>
                <td>
                    {$vo['brand']}
                </td>
                <td>{$vo['stock']}</td>
                <td>{$vo['sold']}</td>
                <td>{$vo.create_time}</td>
                <td>
                    <if condition="$vo['status'] eq 1">
                        已上架
                        <else/>
                        已下架
                    </if>
                </td>
                <td>
                    <a href="{:U('Parameter/index',array('pro_id'=>$vo['id']))}">规格管理</a> |
                    <if condition="$vo['status'] eq 1">
                        <a href="{:U('Product/state',array('id'=>$vo['id'],'state'=>0))}">下架</a> |
                        <else/>
                        <a href="{:U('Product/state',array('id'=>$vo['id'],'state'=>1))}">上架</a> |
                    </if>
                    <a href="{:U('Product/edit',array('id'=>$vo['id']))}">编辑</a> |
                    <a href="javascript:if(confirm('确定删除吗?')){ location.href='{:U('Product/state',array('id'=>$vo['id'],'state'=>-1))}' };">删除</a>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page}</div>
</div>
<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>